package com.wolfking.jeesite.config;

import com.wolfking.jeesite.tool.CloseableRestTemplate;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ToolConfiguration {

    @Bean(destroyMethod = "close")
    public CloseableRestTemplate closeableRestTemplate() {
        return CloseableRestTemplate.INSTANCE;
    }

    @Bean(destroyMethod = "close")
    public PoolingHttpClientConnectionManager connectionManager() {
        return CloseableRestTemplate.CONNECTION_MANAGER_INSTANCE;
    }

    @Bean(destroyMethod = "close")
    public CloseableHttpClient httpClient() {
        return CloseableRestTemplate.HTTPCLIENT_INSTANCE;
    }
}
